<%@ page language="java" import="com.gxuwz.medical.domain.person.*,com.gxuwz.medical.domain.payment.*" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%--引入自定义标签--%>
<%@ taglib prefix="tags" uri="/WEB-INF/tld/custom.tld" %>
<%@ include file="/common/base.jsp"%>
<%
String id = request.getParameter("id");
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<title>参合缴费登记</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/admin.css">
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<!-- 引入第三方弹出对话框JS组件 -->
<script type="text/javascript" src="third/layer/layer.js"></script>
<script type="text/javascript">
//选择不同的村组
function chooseGroup(){
	var val=$("#village").val();
	$.ajax({
		   type: "POST",
		   url: "<%=path%>/system/AreaServlet?m=groupList",
		   data: {"villageID":val},
		   dataType:"json",
		   success: function(data){
			 $("#group").empty();
			 $("#group").append("<option value=''>默认全部</option>");
		     $.each(data,function(i,val){
		    	 $("#group").append("<option value='"+val.areacode+"'>"+val.areaname+"</option>");
		     });
		   }
		});
}
</script>
</head>
<body>
	<form method="post" action="<%=path%>/system/PaymentServlet?m=printpay&id=<%=id %>" id="listform">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder">参合缴费中</strong>
			</div>
			<div class="padding border-bottom">
					 <button class="button border-main icon-search" type="submit"> 打印</button>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th >序号</th>
					<th>家庭编号</th>
					<th>农合证号</th>
					<th>个人姓名</th>
					<th>与户主关系</th>
					<th>性别</th>
					<th>出生年月</th>
					<th>年龄</th>
					<th>身份证号</th>
					<th>乡镇/村/组</th>
					<th>操作</th>
				</tr>
				<%
				
					PersonDao dao = new PersonDao();
				Payment paydao = new Payment();
					String sql = "select * from t_person where famicode=? ";
					Object[] params=new Object[1];
					params[0]=id;
					List<Person> person = dao.queryOjects(sql, params);
				%>
				<%
				List<Payment> list;
					for (int i = 0; i < person.size(); i++) {

						Person model = (Person) person.get(i);
						params[0]=model.getPerscode();
						list=paydao.queryOjects("select * from t_payment where perscode=?",params);
				%>
				<tr>

					<td ><%=i+1 %></td>
					
					<td><%=model.getFamily().getFamicode() %></td>
					<td><%=model.getPerscode() %></td>
					<td><%=model.getPersname() %></td>
						<td><% if("1".equals(model.getRelation())){ %>
					             户主本人
					      <%}else if("2".equals(model.getRelation())){%>
					         配偶
					      <%} else if("3".equals(model.getRelation())){%>
					         子女
					      <%} else if("4".equals(model.getRelation())){%>
					        父母
					    <%} else if("5".equals(model.getRelation())){%>
					         外甥女
					      <%} else if("9".equals(model.getRelation())){%>
					         其他
					      <%} %>
					      </td>
					<td>
					<% if("1".equals(model.getSex())){ %>
					             男
					      <%}else if("2".equals(model.getSex())){%>
					        女
					      <%} %></td>
					<td><%=model.getBirthday() %></td>
					<td><%=model.getAge() %></td>
					<td>
					<tags:hide size="4" value="<%=model.getCardID() %>" start="12"/></td>
					<td><%=model.getFamily().getTown().getAreaname()+model.getFamily().getVillage().getAreaname()+model.getFamily().getGroupNo().getAreaname() %></td>
					<td><div class="button-group">
					        <%
					        if(list!=null&&list.size()>0){
					        %>
					        <input type="text" readonly="readonly" class="button border-main" value="已缴费"> 
					        <%
					        }
					        else {
					        %>
							<a class="button border-main"
								href="<%=path%>/system/PaymentServlet?m=paydo&id=<%=model.getFamily().getFamicode() %>&perscode=<%=model.getPerscode() %>"><span
								class="icon-edit"></span> 缴费</a>
								<%
								}
								%>
						</div></td>
				</tr>
				<%
					}
				%>
			</table>
	
		</div>
	</form>

</body>
</html>
